<?php
declare (strict_types = 1);

namespace app\controller;
use app\model\User;
use app\model\Followers;
use app\Request;
use think\facade\Request as RequestFacade;

class StaticPages
{
   const aaa=111;

    public function home()
    {
        $count=0;
        $topics=[];
        $followers=0;
        $followings=0;
        $topiccount=0;
        if(isLogin())
        {
            $uesrArr =loginUser();
            $user= User::find($uesrArr['id']);
            $topics=$user->feed()->paginate(3);
            $count=$topics->total();
            $followers=$user->followers()->count();
            $followings=$user->followings()->count();
            $topiccount=$user->topics()->count();
        }

        return view('static_pages/home',compact('topics','count','followers','followings','topiccount'));
    }
    public function help()
    {

        return view('static_pages/help');
    }
    public function about()
    {
        return view('static_pages/about');
    }
    public  function test()
    {
        $t=time();
        $a=empty($t);
      echo date("Y-m-d H:i:s",$t),self::aaa;
      echo "<br>";


      var_dump($a) ;
    }

    public function image(Request $request)
    {
        $file = RequestFacade::file('image');
        halt($file);
    }

}
